var winner;
var showedBoxesQty = 0;
var boxesQty = 15;
	 
 $('.fancy .slot1').jSlots({
     time : 6000,
     loops : 6,
     onWin : function(winCount, winners) {
     	onWin(winners);
     }
 });
 $('.fancy .slot2').jSlots({
     time : 7000,
     loops : 9,
     onWin : function(winCount, winners) {
     	onWin(winners);
     }
 });
 $('.fancy .slot3').jSlots({
     time : 7000,
     loops : 8,
     onWin : function(winCount, winners) {
     	onWin(winners);
     }
 });
 $('.fancy .slot4').jSlots({
     time : 6700,
     loops : 7,
     onWin : function(winCount, winners) {
     	onWin(winners);
     }
 });
 $('.fancy .slot5').jSlots({
     time : 6400,
     loops : 6,
     onWin : function(winCount, winners) {
     	onWin(winners);
     }
 });
 $('.fancy .slot6').jSlots({
     time : 6000,
     loops : 5,
     onWin : function(winCount, winners) {
     	onWin(winners);
     }
 });
 $('.fancy .slot7').jSlots({
     time : 5900,
     loops : 5,
     onWin : function(winCount, winners) {
     	onWin(winners);
     }
 });
 $('.fancy .slot8').jSlots({
     time : 5900,
     loops : 6,
     onWin : function(winCount, winners) {
     	 onWin(winners);
     }
 });
 $('.fancy .slot9').jSlots({
     time : 5900,
     loops : 5,
     onWin : function(winCount, winners) {
     	 onWin(winners);
     }
 });
 $('.fancy .slot10').jSlots({
     time : 5900,
     loops : 6,
     onWin : function(winCount, winners) {
     	 onWin(winners);
     }
 });
 $('.fancy .slot11').jSlots({
     time : 6400,
     loops : 6,
     onWin : function(winCount, winners) {
     	 onWin(winners);
     }
 });
 $('.fancy .slot12').jSlots({
     time : 6100,
     loops : 5,
     onWin : function(winCount, winners) {
     	 onWin(winners);
     }
 });
 $('.fancy .slot13').jSlots({
     time : 5800,
     loops : 5,
     onWin : function(winCount, winners) {
     	 onWin(winners);
     }
 });
 $('.fancy .slot14').jSlots({
     time : 5900,
     loops : 5,
     onWin : function(winCount, winners) {
     	 onWin(winners);
     }
 });
 $('.fancy .slot15').jSlots({
     time : 6000,
     loops : 6,
     onWin : function(winCount, winners) {
     	 onWin(winners);
     }
 });
 
function onWin(winners) {
 	$.each(winners, function() {
         this.addClass('winner');
	});
 	
 	showResetButton();
}
 
function beforeStart() {
 	winner = Math.floor((Math.random() * boxesQty) + 1);
 	var elem = $('.sponsorFlip');

elem.flip({
	direction:'lr',
	speed: 350,
	onBefore: function() {
		elem.html(elem.siblings('.sponsorData').html());
		}
	});
}
 
function onStart() {
	$('.slot').removeClass('winner');
}

function reset() {
	location.reload();
}

function showResetButton() {
	showedBoxesQty++;
	if(showedBoxesQty == boxesQty) {
		$("#resetButton").css('visibility', 'visible');
	}
}